package network;

import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

public class ServerSocket extends AbstractSocket {
    protected java.net.ServerSocket listeningSocket = null;
    List<ClientSocket> ListeClientConnectes;

    public ServerSocket() throws IOException {
	super();
    }

    public List<ClientSocket> getListeClientConnectes() {
	return ListeClientConnectes;
    }

    @Override
    protected void creerSocket() throws IOException {
	if (listeningSocket == null) {
	    listeningSocket = new java.net.ServerSocket(port);
	}
	Socket client = listeningSocket.accept();
	ClientSocket newC = new ClientSocket(client);
	//newC.ajouterListener(new PingListener(this));
	ListeClientConnectes = new ArrayList<ClientSocket>();
	ListeClientConnectes.add(newC);
	socket = client;
    }
}
